TK!2
=v
#1
:n
C
:v
4
:s
i
=u
=l
#1
:n
u
:v
'u1
'u2
'u3
'u4
'u5
'u6
'u7
'u8
'u9
'u10
E
#2
:n
u1
:v
1
2
3
4
5
E
#3
:n
u2
:v
0
1
2
3
4
E
#4
:n
u3
:v
-1
0
1
2
3
E
#5
:n
u4
:v
-2
-1
0
1
2
E
#6
:n
u5
:v
E
#7
:n
u6
:v
E
#8
:n
u7
:v
E
#9
:n
u8
:v
E
#10
:n
u9
:v
E
#11
:n
u10
:v
E
#12
:n
w
:v
'w1
'w2
'w3
'w4
'w5
'w6
'w7
'w8
'w9
'w10
E
#13
:n
w1
:v
E
#14
:n
w2
:v
E
#15
:n
w3
:v
E
#16
:n
w4
:v
E
#17
:n
w5
:v
E
#18
:n
w6
:v
E
#19
:n
w7
:v
E
#20
:n
w8
:v
E
#21
:n
w9
:v
E
#22
:n
w10
:v
E
#23
:n
aux
:v
0
E
=f
#1
:n
Multiply
:c
Multiplying a matrix by a scalar
:t
Procedure
:i
c,A,B
#2
:n
Mblank
:c
Blank matrix (i.e. subordinate lists)
:t
Procedure
:i
M,n
#1
:n
Multiply
:z
" The procedure generates a product of a scalar  c  and a matrix defined by
" the master list A  and its subordinate lists.  The resulting matrix is
" stored in lists subordinate to the master list B, which must be set up in
" advance. The master list  B  must be at least as long as to accommodate
" the multiple of the last non-empty row-list in  A  . 

" Blank or missing coefficients in matrix  A  are assumed to be zeros.

" Supporting function: Mblank

n:= 1
for i=1 to length(A)
   if length(A[i])=0 goto nexti
   m:= i
   n:= max(n,length(A[i]))
nexti: next i
call Mblank(B,m)   " error indicates insufficient length of master list C
for i=1 to m
   Ai:= A[i]
   Bi:= B[i]
   for j=1 to n
      Bi[j]:= c*elt(Ai,j,0)
   next j
next i
/E
E
#2
:n
Mblank
:z
" The procedure blanks (i.e. erases the contents) of the first  n  lists
" named in the master list  M .

for i=1 to n
   call blank(M[i])    " error indicates no listname in ith element of M
next i
/E
E
=r
#1
:r
call Multiply(C,'u,'w)    " ***  Multiplication of matrix by scalar  ***
#3
:r
" This is an example of using a library function Multiply for multiplying
:s
C
#4
:r
" a matrix  u  by a scalar  C  and storing the result in  w .  
:s
C
#5
:r
" Press F9 and watch the result come up in the bottom window.
:s
C
#7
:r
" The matrix  u  may be displayed as a table with the same name, and altered
:s
C
#8
:r
" as required.  The value of  C  may be reassigned on the Variable Sheet.
:s
C
=p
=t
#1
:n
u
:s
Screen
:v
Horizontal
:f
1
:r
""
:c
""
:t
"Input matrix"
:u
#1
:l
u1
:w
8
:h
""
#2
:l
u2
:w
8
:h
""
#3
:l
u3
:w
8
:h
""
#4
:l
u4
:w
8
:h
""
E
#2
:n
w
:s
Screen
:v
Horizontal
:f
1
:r
""
:c
""
:t
"Product  of matrix  u  and scalar  C ."
:u
#1
:l
w1
:w
8
:h
""
#2
:l
w2
:w
8
:h
""
#3
:l
w3
:w
8
:h
""
#4
:l
w4
:w
8
:h
""
E
#3
:s
Screen
:v
Vertical
:f
1
:r
""
:c
""
:t
""
:u
E
=n
=g
#1
:c
.000001
:i
10
:v
Yes
:l
60
:f
66
:m
0
:w
80
:b
Yes
:a
Yes
:r
Yes
:h
No
:t
1
:n
Yes
:d
LPT1
%Tr,f,0,1,0,1,0
%Ot,f,1,1,0,1,0>f,0,2,3,5,0>f,0,3,0,2,0
